<!-- 隐患工单 -->
<template>
	<view class="page">
		<cu-custom bgColor="bg-white" :isBack="true">
			<block style="color: #777777;font-size: 48rpx;" slot="content">隐患工单</block>
		</cu-custom>


		<view class="input2">
			<view class="fkms_label">工单名称</view>
			<input v-model="gdmc" class="fkms" maxlength="-1"></input>
		</view>

		<view class="input2">
			<view class="fkms_label">隐患地点</view>
			<input v-model="yhdd" class="fkms" maxlength="-1"></input>
		</view>

		<view class="input2">
			<view class="fkms_label">隐患详情</view>
			<input v-model="yhxq" class="fkms" maxlength="-1"></input>
		</view>

		<view class="padding flex flex-direction my-position">
			<button class="cu-btn margin-tb-sm lg my-btn" @tap="submit">确认提交</button>
		</view>
	</view>
</template>

<script>

	export default {
		onLoad(option) {
			this.ucId = option.ucId
		},
		data() {
			return {
				gdmc: '',
				yhdd: '',
				yhxq: '',
				ucId: ''
			}
		},
		methods: {

			submit() {
				// if (this.gdmc == "" || this.yhdd == "" || this.yhxq == "") {
				// 	uni.showToast({
				// 		title: "数据不完整"
				// 	})
				// 	return;
				// }
				let params = {
					"ucId": this.ucId,
					"feedtype": 1,
					"feedback": "设备故障",

				}
				let app = getApp()
				app.globalData.request({
					url: 'wx/fireAlarmInfo/updateInFireAlarmInfo',
					data: {
						...params
					}
				}).then(function(res) {
					console.info("---------->>>>" + res)
					if (res.data.code == 0) {
						uni.showToast({
							title: "隐患工单创建成功",
							icon: 'success'
						})
						uni.navigateBack({
							delta: 2,
							success: () => {
								let page = getCurrentPages().pop()
								if (!page) {
									return;
								} else {
									let option = {
										type: 'refreshPage'
									}
									page.onShow(option)
								}
							}
						})
					}
				}).catch(function(e) {})
			},
		}
	}
</script>

<style scoped>
	.page {
		width: 100vw;
	}

	.input1 {
		display: flex;
	}

	.input1 input {
		width: 80%;
		height: 80rpx;
		margin: 20rpx 0 0 10rpx;
		background: #FFFFFF;
		box-shadow: 0 0 4px 0 rgba(143, 143, 143, 0.50);
		border-radius: 8rpx;
		padding: 2rpx 4rpx;
	}

	.input2 {
		display: flex;
	}

	.fkms_label {
		font-size: 24rpx;
		color: #999999;
		margin: 20rpx 20rpx;
	}

	.fkms {
		width: 80%;
		margin: 20rpx 0 0 10rpx;
		background: #FFFFFF;
		box-shadow: 0 0 4px 0 rgba(143, 143, 143, 0.50);
		border-radius: 2rpx;
		outline: none;
		padding: 2rpx 4rpx;
	}

	.my-position {
		/* 		width: 100%;
		position:absolute;
		bottom: 220rpx; */
	}

	.my-btn {
		height: 94rpx;
		background-image: linear-gradient(90deg, #FAB53A 4%, #EFA21A 99%);
		box-shadow: 0 0 12px 0 rgba(250, 181, 58, 0.50);
		border-radius: 24px;
		ont-family: PingFangSC-Medium;
		color: #FFFFFF;
	}
	
	
</style>
